//可以发现使用了babel-loader之后es6新的语法模板字符串最终被转换成es低版本兼容的js代码
let num = 1;
let str = `qwe
qweq${num}
12312
qwe`;
//console.log(str);


let prom1 = new Promise(
    function(resolve, reject) {
        var obj = {
            name: 'lhr',
            age: 25
        };
        reject(obj);
    }
);

prom1
.then(
    function(data){
        //console.log('sucess',data);
    }
)
.catch(
    function(err){
       // console.log('err',err);
    }
)

function run(taskDef){
    var gen = taskDef();

    var res = gen.next();

    function step(){
        console.log(res.value);
        res = gen.next();
        if(!res.done){
            step();
        }
    }

    step();
}

function addA(){
    var a = 0;
    return function(add){
        a += (add||1);
        return 'a is ' + a;
    }
}

var a1 = addA();

function *myGenerator(){
    yield a1();
    yield a1(2);
    yield a1();
}

run(myGenerator);